<template>
	<view class="columnbox content">
		<view class="columnbox one-modular" style="padding: 0;">
			<view class="rowbox wdh-100 spb modular-info" @click="showCoupon">
				<view class="rowbox">
					<view class="title">优惠券</view> <text>（用户裂变神器）</text>
				</view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>

		</view>
		<view class="columnbox one-modular" style="padding: 0;">
			<view class="rowbox wdh-100 spb modular-info" @click="showQuickSale">
				<view>单品快卖<text>（10秒发起在线团购）</text></view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
			<view class="rowbox wdh-100 spb modular-info" @click="showRechargeBuy">
				<view>充值购<text>（在线小额充值好帮手）</text></view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
		</view>
		<view class="columnbox one-modular" style="padding: 0;">

			<view class="rowbox wdh-100 spb modular-info" @click="showVip">
				<view>会员管理<text>（精准运营每一个到店用户）</text></view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
			<view class="rowbox wdh-100 spb modular-info" @click="goWxDiscount">
				<view v-if="storeinfo.wxzhekou>0">
					小程序支付折扣&nbsp;&nbsp;{{(storeinfo.wxzhekou||0)/100===1?0:((storeinfo.wxzhekou||0)/100)*10}}折<text>（留存每一个到店用户）</text>
				</view>
				<view v-else>
					小程序支付折扣<text>（留存每一个到店用户）</text>
				</view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
			<view class="rowbox wdh-100 spb modular-info" @click="goYeDiscount">
				<view v-if="storeinfo.zhekou>0">
					余额支付折扣&nbsp;&nbsp;{{(storeinfo.zhekou||0)/100===1?0:((storeinfo.zhekou||0)/100)*10}}折<text>（主动充值用户提升80%）</text>
				</view>
				<view v-else>
					余额支付折扣<text>（主动充值用户提升80%）</text>
				</view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
			<view class="rowbox wdh-100 spb modular-info" @click="showRecharge">
				<view>充值方案<text>（有余额才是真会员）</text></view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>


		</view>
		<!-- <view class="columnbox one-modular" style="padding: 0;">
			<view @click="showShareholder" class="rowbox wdh-100 spb modular-info">
				<view>本店股东</view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
			<view @click="showBasic" class="rowbox wdh-100 spb modular-info">
				<view>基础股东配置</view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
			<view @click="showSenior" class="rowbox wdh-100 spb modular-info" style="border: none;">
				<view>高级股东配置</view>
				<u-icon name="arrow-right" size="28rpx"></u-icon>
			</view>
		</view> -->
		<IosKefu :show="showIosKefu" :type="matype" @close="closeIosKefu"></IosKefu>
	</view>
</template>

<script>
	import auth from '@/utils/auth.js'
	import IosKefu from '@/components/ioskefu.vue'
	export default {
		components: {
			IosKefu
		},
		data() {
			return {
				matype: '',
				showIosKefu: false,
				userinfo: null,
				storeinfo: null,
				shareinfo: null
			};
		},
		onShow() {
			this.addView()
			if (uni.getStorageSync('uid')) {
				this.userinfo = uni.getStorageSync('userInfo')
				this.getStoreInfo()
			}
		},
		onShareAppMessage() {
			return {
				title: this.shareinfo.title,
				imageUrl: this.shareinfo.image,
				path: '/pages/marketing/marketing?pid=' + uni.getStorageSync('uid')
			}
		},
		onShareTimeline() {
			return {
				title: this.shareinfo.title,
				imageUrl: this.shareinfo.image,
				path: '/pages/marketing/marketing?pid=' + uni.getStorageSync('uid')
			}
		},
		onLoad() {
			this.getShareInfo()
		},
		methods: {
			getShareInfo() {
				this.$req.post('/shanghu/yingxiaofw').then(res => {

				})
			},
			addView() {
				this.$req.post('/shanghu/zhuanfayx').then(res => {
					this.shareinfo = res.data.data
				})
			},
			closeIosKefu() {
				this.showIosKefu = false
			},
			async showCoupon() {
				let data = await auth.getAuth('yhj', 'yhjinttime', '/pages/coupon/coupon')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'yhjimg'
				}
			},
			async showRecharge() {
				let data = await auth.getAuth('hy', 'hyinttime', '/pages/recharge/recharge')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'hyimg'
				}
			},
			async showRechargeBuy() {
				let data = await auth.getAuth('czg', 'czginttime', '/pages/rechargebuylist/rechargebuylist')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'czgimg'
				}
			},

			async showQuickSale() {
				// let data = await auth.getAuth('dpkm', 'dpkminttime', '/pages/quicksale/quicksale')
				// if (!data) {
				// 	this.showIosKefu = true
				// 	this.matype = 'dpkmimg'
				// }
				uni.navigateTo({
					url: '/pages/quicksale/quicksale'
				})
			},
			async showVip() {

				let data = await auth.getAuth('hy', 'hyinttime', '/pages/vip/vip')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'hyimg'
				}
			},
			async showShareholder() {
				let data = await auth.getAuth('gd', 'gdinttime', '/pages/shareholder/list')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'gdimg'
				}
			},
			async showBasic() {
				let data = await auth.getAuth('gd', 'gdinttime', '/pages/shareholder/basic')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'gdimg'
				}
			},

			async showSenior() {
				let data = await auth.getAuth('gd', 'gdinttime', '/pages/shareholder/senior')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'gdimg'
				}
			},
			async goWxDiscount() {

				let data = await auth.getAuth('hy', 'hyinttime', '/pages/wxdiscount/wxdiscount')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'hyimg'
				}

			},

			async goYeDiscount() {
				let data = await auth.getAuth('hy', 'hyinttime', '/pages/balanceDiscount/balanceDiscount')
				if (!data) {
					this.showIosKefu = true
					this.matype = 'hyimg'
				}
			},

			getStoreInfo() {

				this.$req.post('/shanghu/shanghuInfo', {
					shanghuid: this.userinfo.shanghuid
				}).then(res => {
					this.storeinfo = res.data.data
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		background: #f4f5f7;
		padding-top: 30rpx;
		padding-bottom: 20rpx;
		min-height: 100vh;
		justify-content: flex-start;
	}

	.top-box {
		width: 100%;
		color: #fff;
		padding: 20rpx 20rpx;
		padding-bottom: 100rpx;
	}

	.iden-box {
		background: linear-gradient(to right, #f5d1b3, #f4d9c6);
		width: 100%;
		justify-content: space-between;
		padding: 20rpx 20rpx;
		border-radius: 10rpx;
		color: #965630;
		font-size: 32rpx;
	}

	.iden-btn {
		background: #4d2d1b;
		color: #fff;
		padding: 10rpx 20rpx;
		border-radius: 10rpx;
		font-size: 24rpx;
		line-height: 40rpx;
	}

	.store-info {
		width: 100%;
		justify-content: space-between;
		align-items: flex-end;
	}

	.store-detail {
		margin-top: 20rpx;
		color: #fff;
		line-height: 50rpx;
		font-size: 24rpx;

		.info-title {
			font-size: 32rpx;
			line-height: 60rpx;
		}
	}

	.show-btn {
		width: 170rpx;
		font-size: 28rpx;
		color: #fff;
		border-left: #fff solid 1px;

		image {
			margin-bottom: 10rpx;
			width: 50rpx;
			height: 50rpx;
		}
	}

	.modular-box {
		width: 710rpx;
		background: #fff;
		padding: 10rpx 32rpx 32rpx 32rpx;
		border-radius: 20rpx;
	}

	.count-box {
		// margin-top: -70rpx;
	}

	.order-title {
		font-size: 24rpx;
		color: #a7a7a7;
	}

	.order-count {
		width: 100%;
		font-size: 40rpx;
		color: #000;
		font-size: 40rpx;
		font-weight: bold;
		margin-top: 20rpx;

		padding-bottom: 32rpx;
		text-align: center;
	}

	.order-num {
		border-bottom: #ebebeb solid 1px;
	}

	.order-modular {
		font-size: 28rpx;
		justify-content: space-between;
		margin-top: 32rpx;
		width: 100%;
	}

	.one-modular {
		background: #fff;
		border-radius: 20rpx;
		font-size: 28rpx;
		margin-top: 20rpx;
		padding: 32rpx 32rpx;
		width: 710rpx;
	}

	.title {}

	.modular-info {
		padding: 32rpx 32rpx;
		border-bottom: #f7f5f9 solid 1px;

		text {
			font-size: 24rpx;
			color: #49b457;
		}
	}
</style>